<!DOCTYPE html>
<#assign dicSelect=JspTaglibs["http://www.casic304.cn/dicSelect"] />
<#assign secSelect=JspTaglibs["http://www.casic304.cn/secSelect"] />
<#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />
<html>
<head>
    <meta charset="utf-8">
    <title>DPA基本信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
    <style>
        .selch .layui-icon-date {
            top: 6px !important;
        }
    </style>
</head>
<body class="listBody">
<div class="qbdms-list">
    <div class="layui-table-view-body" style="height: 100%">
        <div class="ccpui-enterSel">
            <form class="layui-form" action="" lay-filter="wQbdReportTemplateQueryForm">
                <div class="layui-form-body selch">
                    <div class="table-top-filter layui-row">
                        <div class="qbdms-listForm">
                            <label class="layui-form-label">单位<span style="color: red;">*</span></label>
                            <div class="layui-input-block">
                                <select class="layui-input filter-value" name="dw" lay-filter="xh" lay-verify="required" lay-search="" placeholder="请输入"/></select>
                            </div>
                        </div>
                        <div class="qbdms-listForm">
                            <label class="layui-form-label">统计时间开始<span style="color: red;">*</span></label>
                            <div class="layui-input-block">
                                <input type="text" readonly class="layui-input dateTimeFiled filter-value start_time1" name="starttime"  lay-verify="required" placeholder="请输入"/>
                            </div>
                        </div>
                        <div class="qbdms-listForm">
                            <label class="layui-form-label">统计时间结束<span style="color: red;">*</span></label>
                            <div class="layui-input-block">
                                <input type="text" readonly class="layui-input dateTimeFiled filter-value end_time1" name="endtime"  lay-verify="required" placeholder="请输入"/>
                            </div>
                         </div>
                        <div class="qbdms-listForm">
                            <label class="layui-form-label">故障产品名称</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input  filter-value " name="productname" placeholder="请输入"/>
                            </div>
                        </div>
                        <div class="selchBtn">
                            <a class="layui-btn layui-btn-sm fillBtn" lay-filter="tjsj" lay-submit >
                                <i class="layui-icon layui-icon-search"></i><span>查询</span>
                            </a>
                            <div class="layui-btn-group">
                                <button type="button" class="layui-btn layui-btn-sm" lay-filter="daochu" title="导出" lay-submit  style="width: 28px;font-size: 12px;padding: 0">
                                    <i class="layui-icon layui-icon-download-circle"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div style="margin: 10px 0;background: white">
            <table id="wQbdReportTemplateTable" lay-filter="wQbdReportTemplateTable"></table>
        </div>
    </div>
</div>

<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'common', 'laydate', 'jquery', 'publicMethods','form','table','propsHandle'], function () {
        var laydate = layui.laydate;
        var $ = layui.jquery;
        var publicMethods = layui.publicMethods;
        var common = layui.common;
        var form = layui.form;
        var table = layui.table;
        var tableH=publicMethods.tabHeight();

        publicMethods.reflashDate({startName: '.start_time1', endName: '.end_time1'});

        var dw = eval('${dw}'); //单位
        common.initDicData("dw", dw, "");
        var propsHandle = layui.propsHandle;
        var defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle();  // 实例化模板功能部分
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });

        form.on('submit(daochu)', function(data){
            function open(url , param){
                var curUrl = url;
                layui.layer.open({
                    type: 2,
                    area: ['700px', '520px'],
                    title: ['自定义导出', 'font-size:14px;'],
                    content: serverPath.qbdmsPath + '/qbdms/topfiveproblem/view/export',
                    btnAlign: 'c',
                    skin: 'qbdms-layerFormBtn',
                    btn: ['确定', '取消'],
                    yes: function(index, layero){
                        url = curUrl;
                        var iframeWin = window["layui-layer-iframe" + index];
                        var data = iframeWin.getData();
                        if(data){
                            url = url + "?data=" + JSON.stringify(data) + param;
                            window.location.href = encodeURI(url)
                        }
                    }
                });
            }
            layui.layer.confirm(publicMethods.confirmStyle("是否导出?"),{title: false,skin: 'confirm-class'}, function (index) {
                layui.layer.close(index);
                var url = serverPath.qbdmsPath + '/qbdms/topfiveproblem/exportData';
                var param = "";

                $("form[lay-filter='wQbdReportTemplateQueryForm']").find(".filter-value").each(function (i, value) {
                    param += "&"+this.name+"="+this.value
                });
                open(url, param);
            });


        })

        form.on('submit(tjsj)', function(data){
            table.render({
                elem: '#wQbdReportTemplateTable'
                // ,height:tableH
                ,url:serverPath.qbdmsPath + '/qbdms/topfiveproblem/getdata'
                ,where:data.field
                ,page: true //开启分页
                ,limit: 20
                // ,toolbar: '#wQbdReportTemplateHeaderToolsBar'
                ,method: 'get'
                ,autoSort: false //是否排序
                ,defaultToolbar: []
                ,cols: [[ //表头
                    {type: 'checkbox', fixed: 'left'}
                    ,{field: 'sn', type: 'numbers', title: '序号', fixed: 'left'}
                    ,{field: 'ORGNAME', title: '数据来源单位', sortname: '',minWidth:120}
                    ,{field: 'CPMC', title: '故障产品名称', sortname: 'f_problemname',hide:false,minWidth:120}
                    ,{field: 'NUMS', title: '质量问题数', sortname: 'f_modelsymbol',hide:false,minWidth:120}
                    ,{field: 'ZB', title: '占本院质量问题总数的比例', sortname: 'f_productname',hide:false,minWidth:200}

                ]],done:function () {
                    common.tableSelectCon('.ccpui-enterSel .layui-form input','a[lay-event=query]','.ccpui-enterSel');
                }
            });

            return false;
        })
    });


</script>
</body>
</html>